package trunk.src.levelUp.Library;

import java.util.StringTokenizer;

/**
 * Created with IntelliJ IDEA.
 * User: Станислав
 * Date: 18.01.14
 * Time: 13:17
 * To change this template use File | Settings | File Templates.
 */
public class Book {

    private int id;
    private String name;
    private String author;

    public Book(int id, String name, String author) {
        this.id = id;
        this.name = name;
        this.author = author;
    }

    public Book(String fromFile) {
        StringTokenizer tokenizer = new StringTokenizer(fromFile, "|");
        this.id = Integer.parseInt(tokenizer.nextToken());
        this.name = tokenizer.nextToken();
        this.author = tokenizer.nextToken();
    }

    @Override
    public String toString() {
        return id + "|" + name + "|" + author;
    }

    public int getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public String getAuthor() {
        return author;
    }
}
